package example;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

public class ThreadHandlerDemo {

	Handler handler = new Handler(){
		public void handleMessage(android.os.Message msg) {
			//update UI here
		};
	};
	
	Thread thread = new Thread(){
		public void run() {
			Message m = handler.obtainMessage();
			Bundle b = new Bundle();
			b.putString("KEY", "values");
			m.setData(b);
			handler.sendMessage(m);
		};
		
	};
	
}

/*private void postToTwitter(final String review) {
		new Thread() {
			@Override
			public void run() {
				int what = 0;
				
				try {
					twitterApp.updateStatus(review);
				} catch (Exception e) {
					what = 1;
				}
				
				mHandler.sendMessage(mHandler.obtainMessage(what));
			}
		}.start();
	}
	
	private Handler mHandler = new Handler() {
		@Override
		public void handleMessage(Message msg) {
			String text = (msg.what == 0) ? "Posted to Twitter" : "Post to Twitter failed";
			Toast.makeText(BaseActivity.this, text, Toast.LENGTH_SHORT).show();
		}
	};*/
